import {
	http
} from '@/service/index.js'
import store from '@/store/index.js'
import configs from '@/config/index.js'

// 每日特价产品分页查询
export const dailySpecialsListPage = async (data, config = {}) => {
	return await http.get(`/index/product/dailySpecialsListPage`, data, config)
}

export const grouplistPage = async (data, config = {}) => {
	const resp = await http.get(`/index/product/productGroupListPage`, data, config)
	if (resp.data && resp.data.length) {
		resp.data = resp.data.map(v => {
			v.process = (Number(v.participationNum) / Number(v.productPortionNum) * 100).toFixed(0)
			return v
		})
	}
	return resp
}
// 会员产品分页查询
export const vipListPage = async (data, config = {}) => {
	return await http.get(`/index/product/vipListPage`, data, config)
}
// 积分产品分页查询
export const receiveSeed = async (data, config = {}) => {
	return await http.post(`/index/product/integralListPage`, data, config)
}


export const classifyList = async (data, config = {}) => {
	return await http.get(`/index/product/productClassifyList`, data, config)
}

export const productGroupDetail = async (data, config = {}) => {
	return await http.get(`/index/product/productGroupDetail`, data, config)
}

export const dailySpecialsDetail = async (data, config = {}) => {
	return await http.get(`/index/product/dailySpecialsDetail`, data, config)
}

export const integralListPage = async (data, config = {}) => {
	return await http.get(`/index/product/integralListPage`, data, config)
}

export const userVipLevelList = async (data, config = {}) => {
	return await http.get(`/index/product/userVipLevelList`, data, config)
}


export const productListPage = async (data, config = {}) => {
	return await http.get(`/index/product/listPage`, data, config)
}


export const productDetail = async (data, config = {}) => {
	return await http.get(`/index/product/detail`, data, config)
}

export const vipDetail = async (data, config = {}) => {
	return await http.get(`/index/product/vipDetail`, data, config)
}

export const integralDetail = async (data, config = {}) => {
	return await http.get(`/index/product/integralDetail`, data, config)
}

export const groupCreate = async (data, config = {}) => {
	return await http.post(`/index/order/groupCreate`, data, config)
}

export const groupSetAddress = async (data, config = {}) => {
	return await http.post(`/index/order/groupSetAddress`, data, config)
}
